package com.hp.process;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * 连接监听看门狗:每连上一个，开启一个线程专门接受心跳，发布任务
 */
public  class ConnWatchDog implements Runnable{
    public void run(){
        try {
            ServerSocket ss = new ServerSocket(Server.port,5);//初始化服务
            while(Server.running){
                Socket s = ss.accept();//阻塞函数
                new Thread(new SocketAction(s)).start();
            }
        } catch (IOException e) {
            e.printStackTrace();
            Server.stop();
        }

    }
}
